//
//  EventOverviewCell.m
//  whopaidforit
//
//  Created by Hoang Vu on 1/27/13.
//  Copyright (c) 2013 Hoang Vu. All rights reserved.
//

#import "EventOverviewCell.h"

@implementation EventOverviewCell

@synthesize title, totalAmount, amount, imageTitle, imageTotalAmount, imageAmount, btEdit;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier statusAmount:(int) statusAmount
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        title = [[UILabel alloc] initWithFrame:CGRectMake(50, 9, 100, 21)];
        title.backgroundColor = [UIColor clearColor];
        [title setTextColor:[UIColor colorWithRed:0.247 green:0.243 blue:0.243 alpha:1.0]];
        [self.contentView addSubview:title];
        
        btEdit = [UIButton buttonWithType:UIButtonTypeRoundedRect ];
        btEdit.frame = CGRectMake(250, 9, 50, 25);
        [btEdit setTitle:@"Wijzig" forState:UIControlStateNormal];
        [btEdit setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
        [btEdit.titleLabel setFont:[UIFont systemFontOfSize:12]];
        //btEdit.buttonType = UIButtonTypeCustom;
        [self.contentView addSubview:btEdit];
        
        totalAmount = [[UILabel alloc] initWithFrame:CGRectMake(50, 47, 190, 21)];
        totalAmount.backgroundColor = [UIColor clearColor];
        [totalAmount setTextColor:[UIColor colorWithRed:0.337 green:0.588 blue:0.765 alpha:1.0]];
        [StyleControl setPriceStyle:totalAmount];
        [self.contentView addSubview:totalAmount];
        
        amount = [[UILabel alloc] initWithFrame:CGRectMake(50, 87, 190, 21)];
        amount.backgroundColor = [UIColor clearColor];
        if(statusAmount > 0)
            [amount setTextColor:[UIColor blackColor]];
        else
            [amount setTextColor:[UIColor colorWithRed:0.8 green:0.22 blue:0.067 alpha:1.0]];
        [StyleControl setPriceStyle:amount];
        [self.contentView addSubview:amount];
        [StyleControl drawLine:self.contentView PositionX:5 PositionY:38 Width:315];
        [StyleControl drawLine:self.contentView PositionX:5 PositionY:78 Width:315];
        imageTitle = [[UIImageView alloc] initWithFrame:CGRectMake(10, 5, 25, 25)];
        UIImage *image = [UIImage imageNamed:@"event"];
        imageTitle.image = image;
        [self.contentView addSubview:imageTitle];
        imageTitle = [[UIImageView alloc] initWithFrame:CGRectMake(10, 45, 25, 25)];
        image = [UIImage imageNamed:@"bagMoner"];
        imageTitle.image = image;
        [self.contentView addSubview:imageTitle];
        imageTitle = [[UIImageView alloc] initWithFrame:CGRectMake(10, 85, 25, 25)];
        image = [UIImage imageNamed:@"person"];
        imageTitle.image = image;
        [self.contentView addSubview:imageTitle];
    }
    
    //for background
    GraphicDrawView *cellView = [[GraphicDrawView alloc] init];
    cellView.optionDraw = @"cell";
    self.backgroundView = cellView;
    [cellView release];
    
    //for hover background
    GraphicDrawView *cellHView = [[GraphicDrawView alloc] init];
    cellHView.optionDraw = @"cell";
    cellHView.optionHover = YES;
    self.selectedBackgroundView = cellHView;
    [cellHView release];
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
@end
